home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: miker3@ix.netcom.com (Mike Rubenstein)
- Newsgroups: comp.lang.c
- Subject: Re: malloc woes with watcom C
- Date: Sun, 31 Dec 1995 23:07:30 GMT
- Organization: Netcom
- Message-ID: <30e71604.75895232@nntp.ix.netcom.com>
- References: <Pine.LNX.3.90.951230212738.7388A-100000-100000-100000@public.compusult.nf.ca>
- NNTP-Posting-Host: ix-dc12-14.ix.netcom.com
- X-NETCOM-Date: Sun Dec 31 3:06:44 PM PST 1995
- X-Newsreader: Forte Agent .99c/16.141
-
- Elliott Noel <jnoel@public.compusult.nf.ca> wrote:
-
- |>
- |> I looked through the faq and noticed a few answers pertaining to
- my
- |>problem, but nothing that seems to help me.
- |>
- |> My problem is that my program generates an exception and crashes
- during
- |>legitimate calls to malloc(). It always seems to happen after a few
-
- |>calls have already been made, and I can't localize the problem, just
- that
- |>it occurs within the code for the malloc() function.
- |>
- |> I am working under dos4gw flat memory model with Watcom C. If
- anybody
- |>has experienced this problem and knows anything about correcting it,
-
- |>please contact me - you can imagine how cripling it is to my work
- not to
- |>be able to allocate memory dynamically...
-
- This almost always means you've stepped on some memory you shouldn't
- have. Somewhere in your program you're overwritting some of the
- memory in the heap and malloc() is getting confused.
-
- If so, there's nothing wrong with the malloc() that's failing. The
- problem occurse earlier -- possibly much earlier.
-
- Thee errors can be murder to find. As a first step, try sprinkling
- your program with _heapchk() calls. When _heapchk() returns something
- other than _HEAPOK, the heap is corrupt.
-
- There are various heap checkers available, but I'm not sure if there
- are any for Watcom C. These monitor heap activity and report errors
- when found.
-
- Michael M Rubenstein
-